package com.zwps.common.core.exception;

import com.zwps.common.core.exception.status.InterfaceCommonExceptionStatus;

import lombok.Getter;

@Getter
public abstract class AbstractCommonException extends RuntimeException implements InterfaceCommonExceptionStatus {

    private static final long serialVersionUID = 1L;

    private final InterfaceCommonExceptionStatus status;

    public AbstractCommonException() {
        this.status = exceptionStatusEnum();
    }

    public AbstractCommonException(String message) {
        super(message);
        this.status = exceptionStatusEnum();
    }

    public AbstractCommonException(InterfaceCommonExceptionStatus status) {
        super(status.getDescribe());
        this.status = status;
    }

    public AbstractCommonException(InterfaceCommonExceptionStatus status, String message) {
        super(message);
        this.status = status;
    }

    public int getCode() {
        return status.getCode();
    }

    public String getDescribe() {
        return status.getDescribe();
    }

    public abstract InterfaceCommonExceptionStatus exceptionStatusEnum();

}
